package action;

import java.util.Collection;

import model.Instituicao;
import persistence.InstituicaoDAO;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class ConsultaInstituicaoAction extends ActionSupport {

	private Instituicao instituicao;

	private Collection<Object> instituicoes;

	public Collection<Object> getInstituicoes() {
		return instituicoes;
	}

	public void setInstituicoes(Collection<Object> instituicoes) {
		this.instituicoes = instituicoes;
	}
	
	public Instituicao getInstituicao() {		
		return instituicao;
	}

	public void setInstituicao(Instituicao instituicao) {
		this.instituicao = instituicao;
	}
	
	public String input(){
		return INPUT;
	}	
	
	public String consultar() {
		System.out.println("############## consultar");
		

		
		instituicoes = InstituicaoDAO.getInstance().getInstituicoesAccordingTo(instituicao);
		
		//TODO teste
//		instituicoes = new ArrayList<Instituicao>();
//		instituicoes.add(new Instituicao("UFCG_test", "Surubim_test", "Giovanni_test", "Fulano_test"));
//		instituicoes.add(new Instituicao("DERE", "Surubim", "Mamae", "sicrano"));
		
		return SUCCESS;
	}
}
